<template>
  <v-app-bar app color="#F5F5F5" elevate-on-scroll dense>
    <v-btn icon @click="back">
      <v-icon>mdi-chevron-left</v-icon>
    </v-btn>
    <v-toolbar-title class="body-1" v-text="title"></v-toolbar-title>
  </v-app-bar>
</template>

<script>
export default {
  name: 'go-back-topbar',
  props: {
    title: {
      required: true,
      type: String
    },
    extraIcon: {
      required: false,
      type: String
    },
    backTo: {
      required: false,
      type: String
    }
  },
  methods: {
    back() {
      if (this.backTo) {
        this.$router.push(this.backTo);
      } else {
        this.$router.go(-1);
      }
    }
  }
};
</script>
